]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
layout: Clarify startup animation code
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 27 Nov 2025 22:41:35 +0000 (23:41 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 1 Dec 2025 18:39:44 +0000 (18:39 +0000)
Once the LayoutManager is initialized, we do the startup animation
that consists of 4 steps:

 1. load the system background
 2. prepare the animation
 3. run the animation
 4. complete initialization post-animation

This isn't immediately obvious right now, as the individual steps
are chained in various ways.

It also doesn't help that it's `_loadBackground()` that starts the
chain, as that hardly implies "startup animation".

Clarify that code by adding an async `_doStartupAnimation()` method
that handles all steps in order.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3988>

js/ui/layout.js

index 5a09ea797c1c6bfc4c851186dae4589df7e393ef..06afaa2aa70397028a34b0f73b6d341dde024048 100644 (file)
@@ -355,7 +355,7 @@ export const LayoutManager = GObject.registerClass({
     init() {
         Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
 
-        this._loadBackground().catch(logError);
+        this._doStartupAnimation().catch(logError);
     }
 
     showOverview() {
@@ -664,6 +664,22 @@ export const LayoutManager = GObject.registerClass({
         return this._keyboardIndex;
     }
 
+    async _doStartupAnimation() {
+        await this._loadBackground();
+
+        this._systemBackground.show();
+        global.stage.show();
+
+        try {
+            await this._prepareStartupAnimation();
+            await this._startupAnimation();
+        } catch (e) {
+            logError(e);
+        } finally {
+            this._startupAnimationComplete();
+        }
+    }
+
     async _loadBackground() {
         await this._ensurePrimaryMonitor();
 
@@ -685,10 +701,6 @@ export const LayoutManager = GObject.registerClass({
         });
 
         await promise;
-
-        this._systemBackground.show();
-        global.stage.show();
-        this._prepareStartupAnimation().catch(logError);
     }
 
     // Startup Animations
@@ -753,12 +765,6 @@ export const LayoutManager = GObject.registerClass({
             setTimeout(() => this.emit('startup-prepared'), 200);
         else
             this.emit('startup-prepared');
-
-        try {
-            await this._startupAnimation();
-        } finally {
-            this._startupAnimationComplete();
-        }
     }
 
     async _startupAnimation() {